package vip.mall.modular.specialist.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import vip.mall.modular.specialist.entity.Specialist;
import vip.mall.modular.specialist.mapper.SpecialistMapper;
import vip.mall.modular.specialist.params.AddSpecialistParams;
import vip.mall.modular.specialist.service.SpecialistService;

import java.util.List;

/**
 * @author Asus
 * @Date 2025/2/10 15:30
 * @Descripition
 */

@Service
public class SpecialistServiceImpl extends ServiceImpl<SpecialistMapper, Specialist> implements SpecialistService {
    @Override
    public boolean add(AddSpecialistParams addSpecialistParams) {
        Specialist specialist = BeanUtil.copyProperties(addSpecialistParams, Specialist.class);
        return save(specialist);
    }

    @Override
    public List<Specialist> findName(String specName) {
        LambdaQueryWrapper<Specialist> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.like(Specialist::getSpecName,specName);
        return baseMapper.selectList(lambdaQueryWrapper);
    }
}
